---
title: Token Integration with Anchor
description:
  Learn how to interact with Solana's Token Programs from an Anchor Program.
---

## What are Token Programs?

On Solana, there are two main token programs (developed by
[Anza](https://www.anza.xyz/), previously Solana Labs):

1. [Token Program (Original)](https://github.com/solana-program/token)
   - Basic token functionality (mint, transfer, etc.)
   - Immutable and widely used
2. [Token Extension Program (Token 2022)](https://github.com/solana-program/token-2022)
   - Includes all original Token Program features
   - Adds additional functionality through "extensions"
   - Recommended for new tokens

## Invoking Token Programs in an Anchor Program

The [`anchor-spl`](https://github.com/coral-xyz/anchor/tree/0e5285aecdf410fa0779b7cd09a47f235882c156/spl) crate
simplifies the process of interacting with Solana's Token Programs in an Anchor
program. This crate includes instructions and account types for both the
original Token Program and the newer Token Extension Program (Token 2022).

Simply add the `anchor-spl` crate as a dependency to your program and add `"anchor-spl/idl-build"` to idl-build feature list in `Cargo.toml`. For a
walkthrough of how to create an Anchor program locally, see the
[quickstart page](/docs/quickstart/local).

```shell title="Terminal"
cargo add anchor-spl
```

```toml title="Cargo.toml"
[features]
idl-build = [
    "anchor-lang/idl-build",
    "anchor-spl/idl-build",
]

[dependencies]
anchor-lang = "0.32.1"
anchor-spl = "0.32.1"
```

### Core Modules

The most commonly used modules provided by the `anchor-spl` crate include:

| Module                                                                                                                                     | Description                                                                              |
| -------------------------------------------------------------------------------------------------------------------------------------------| ---------------------------------------------------------------------------------------- |
| [`token`](https://github.com/coral-xyz/anchor/blob/0e5285aecdf410fa0779b7cd09a47f235882c156/spl/src/token.rs)                              | Token Program (legacy) instructions and account types                                    |
| [`token_2022`](https://github.com/coral-xyz/anchor/blob/0e5285aecdf410fa0779b7cd09a47f235882c156/spl/src/token_2022.rs)                    | Token 2022 base instructions (instructions matching the Token Program functionality)     |
| [`token_2022_extensions`](https://github.com/coral-xyz/anchor/tree/0e5285aecdf410fa0779b7cd09a47f235882c156/spl/src/token_2022_extensions) | Token 2022 extensions instructions                                                       |
| [`token_interface`](https://github.com/coral-xyz/anchor/blob/0e5285aecdf410fa0779b7cd09a47f235882c156/spl/src/token_interface.rs)          | Implementation of account types that work with both Token Program and Token 2022 Program |
| [`associated_token`](https://github.com/coral-xyz/anchor/blob/0e5285aecdf410fa0779b7cd09a47f235882c156/spl/src/associated_token.rs)        | Associated token account instruction                                                     |

The following pages provide examples of how to use the `anchor-spl` crate in an
Anchor program.
